package com.PeidongYunxuan.sensorsdetector.adapter;

import java.util.ArrayList;

import android.content.Context;
import android.content.Intent;
import android.net.Uri;

public class SendFile {
	private static Context mContext;

	public SendFile(Context mContext) {
		this.mContext = mContext;
	}

	public void mSendViaGmailSingleFile(String ToEmail1, String ToEmail2, String Subject,
			String ContentText, String strFolderPath, String strFileName) {
		Intent intent = new Intent(Intent.ACTION_SEND);
		String[] tos={ToEmail1,ToEmail2};
		intent.putExtra(Intent.EXTRA_EMAIL, tos);
//		intent.putExtra(Intent.EXTRA_CC, CcEmail);
		intent.putExtra(Intent.EXTRA_TEXT, ContentText);
		intent.putExtra(Intent.EXTRA_SUBJECT, Subject);

		intent.putExtra(Intent.EXTRA_STREAM, Uri.parse(strFolderPath + strFileName));
//		ArrayList<Uri> imageUris = new ArrayList<Uri>();
//		imageUris.add(Uri.parse(strFolderPath + strFileName));
		// imageUris.add(Uri.parse("file:///mnt/sdcard/b.jpg"));
//		intent.putParcelableArrayListExtra(Intent.EXTRA_STREAM, imageUris);
		intent.setType("image/*");
		intent.setType("message/rfc882");
		Intent.createChooser(intent, "Choose Email Client");
		mContext.startActivity(intent);
	}
	public void mSendViaGmailNoneFile(String ToEmail, String Subject,
			String ContentText) {
		Intent intent=new Intent(Intent.ACTION_SENDTO); 
		intent.setData(Uri.parse("mailto:"+ToEmail)); 
		intent.putExtra(Intent.EXTRA_SUBJECT, Subject); 
		intent.putExtra(Intent.EXTRA_TEXT, ContentText); 
		Intent.createChooser(intent, "Choose Email Client");
		mContext.startActivity(intent);
	}
}
